import { ApiPropertyOptional } from '@nestjs/swagger';
import { MaxLength, IsOptional, ValidateIf, IsString } from 'class-validator';

export class CategoryDto {
    @ApiPropertyOptional({ required: true, description: '模块名称' })
    @MaxLength(50, { message: '长度最大为50' })
    @IsString({ message: '类目名称必须为字符串' })
    @ValidateIf((o) => o.name != '')
    @IsOptional()
    readonly name?: string;
}
